<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%String path = request.getContextPath() ;%>
<%@ taglib uri="/WEB-INF/tld/c.tld" prefix="c" %> 
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>流程信息</title>
<jsp:include page="../../import.jsp" flush="true" />
</head>
<body class="iframeBody">
<div class="Wrapper">
        <div>
        	<input type="hidden" id="id" value="${id}">
            <div id="ligergridDB" class="sq-grid"></div>
        </div>
    </div>

<script type="text/javascript">
	var gridDB = null;
	var pageInApp={}; // to 下一级子窗口 接口
    var pageInTab=null;
	$(function () {
		$("#exeFlowId").hide();
		$("#privateTaskId").hide();
		initTab();
		var param = $('#id').val();
		initGridDB(param);//初始化待办列表
	});
    
    
    //初始化待办列表
    function initGridDB(param){
    	$("#ligergridDB").ligerGrid({
	    	url: '<%=path%>/rfbase/fribaseinfo/initFriBaseFlowList.do?id='+param,
	    	method : 'get',
	        columns: [
	            { display: '流程编号', name: 'pNo',  width: 300, enabledSort:false,
	            	render: function (rowdata, rowindex, value, column) { 
            			if(StringUtils.isEmpty(value)){
                			value = "";
                		}
            			var h = '';
            		    h='<a href="javascript:showFlow(';
                        h+="'"+rowindex+"'";
                        h+=')">'+value+'</a>'
                        return h;
            		}
	            },
	            { display: '处理状态', name: 'audStsCdNm', minWidth: 100 , enabledSort:false},
	            { display: '发起人', name: 'usrNm', width: 100,align:'center' , enabledSort:false},
	            { display: '发起时间', name: 'crtTm', minWidth: 100 , render:renderDate, enabledSort:false},
	        ],
	        pageSize:10,
	        root:'rows',
	        record:'total',
	        hideLoadButton : true,
	        width: '100%',
	        height:'100%',
	        heightDiff:-30,
	        rownumbers:true
	    });
	    gridDB = liger.get("ligergridDB");
	    gridDB.setHeight(100);
	    gridDB.options.isSingleCheck=true;
    }
    
    function showFlow(_index){
    	var _pNo = gridDB.rows[_index].pNo;
    	var _audStsCd = gridDB.rows[_index].audStsCd;
    	var _pInstId = gridDB.rows[_index].pInstId;
    	var _dataId  = gridDB.rows[_index].dataId;
    	
    	if(StringUtils.isEmpty(_pInstId)){
			UIUtils.alertWarning(CommonConstant.C_P_INSTANCEID_NOT_HERE);
			return;
		}
    	var _formUrl = null;
    	if(_pNo.indexOf("融资机构审核")>=0){
    		_formUrl ="/rfbase/fribaseinfo/toDetailPage.do?id=";
    	}
    	if(_pNo.indexOf("授信")>=0){
    		_formUrl = "/rfbase/crbaseinfo/toDetailPage.do?lgcId="
    	}
    	if(_pNo.indexOf("报价")>=0){
    		_formUrl = "/rfbase/scmbaseinfo/toDetail.do?id="
    	}
    	if(_pNo.indexOf("融资机构账户")>=0){
    		_formUrl = "/rfbase/fribaseinfo/toBankAccDetailPage.do?id="
    	}
    	if(_pNo.indexOf("狮桥自有账户审核")>=0){
    		_formUrl = "/system/sysBkAccInfo/toBkAccInforDetailPage.do?id="
    	}
    	if(_pNo.indexOf("卓远担保新业务评审")>=0){
    		_formUrl = "/rfbase/fribaseinfo/tofundGuaranteeDetail.do?id="
    	}
		var params = "?pInsId="+_pInstId+"&status="+_audStsCd+"&businessKey="+_dataId+"&formUrl="+_formUrl;
		Add_navTab('tab_spl_bank_flow_'+_pInstId,'查看流程',"<%=path%>/flow/flow/toFlowShowPageFowBus.do"+params);
    }
    
  //初始化回调
	function initCallback(msg) {
	  	if(null != msg.rows[0]){
			exeRow(msg.rows[0]);//设置数据
	  	}
	  	else{
	  		$.ligerDialog.warn('系统错误 ！');
	  	}
	}
    
	//格式化时间
	function renderDate(rowdata, index, value){
		var dateStr = "";
		if(null != value){
			var date = new Date(value);
			dateStr = DateUtils.formatDate(date, DateUtils.YYYY_MM_DDHHMMSS);
		}
		return dateStr;
	}
	
	//初始化Tab页
    function initTab(){
        pageInTab = $("#pageInTab").ligerTab({
            height: 'auto',
            contextmenu: false,
            minIframeHeight: GET_minIframeHeight(),
            onAfterSelectTabItem: function(tabid) {
                SetIframe_height();
            }
        });

        $.extend(true, pageInApp, {
            pageInTab: pageInTab
        });
    }
</script>

</body>
</html>